<?php 
$j = 0;
if($adc->CurrentAd->getCatId() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('category'));
	$rows[0][$j]['value'] = '<a href="'.$katana->getURL().'/adcat/'.$adc->CurrentAd->getCatId().'/adbrand/'.$adc->CurrentAd->getBrandId().'/">';
	if($adc->CurrentAd->getDisplayIsNew())
	{
		if($adc->CurrentAd->getIsNew() == 0)
		{ $rows[0][$j]['value'] .= ucfirst($txt->getWord('used')).' '; }
	}
	
	$rows[0][$j]['value'] .= $adc->CurrentAd->getBrandTitle().' '.$adc->CurrentAd->getCatTitle().'</a>';
	$j++;
}

$rows[0][$j]['label'] = ucfirst($txt->getWord('type'));
$rows[0][$j]['value'] = ucfirst($adc->CurrentAd->getIsBuyingText());

if($adc->CurrentAd->getDisplayIsNew())
{
	if($adc->CurrentAd->getIsNew())
	{ $rows[0][$j]['value'] .= ' - '.ucfirst($txt->getWord('new')); }
	else
	{ $rows[0][$j]['value'] .= ' - '.ucfirst($txt->getWord('used')); }
}

$j++;

/*
if($adc->CurrentAd->getBrandId() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('brand'));
	$rows[0][$j]['value'] = '<a href="'.$katana->getURL().'/adcat/'.$adc->CurrentAd->getCatId().'/adbrand/'.$adc->CurrentAd->getBrandId().'/">'.$adc->CurrentAd->getBrandTitle().'</a>';
	$j++;
}
*/
if($adc->CurrentAd->getModel())
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('model'));
	$rows[0][$j]['value'] = '<span itemprop="brand">'.$adc->CurrentAd->getBrandTitle().'</span> <span itemprop="model">'.trim($txt->truncate($adc->CurrentAd->getModel(), 30, '', '', '')).'</span>';
	$j++;
}
if($adc->CurrentAd->getYear() > 0)
{
	if($adc->getCurrentAd()->getIsBuying())
	{ $rows[0][$j]['label'] = ucfirst($txt->getWord('year_production').' '.$txt->getWord('from')); }
	else
	{ $rows[0][$j]['label'] = ucfirst($txt->getWord('year_production')); }
	$rows[0][$j]['value'] = $adc->CurrentAd->getYear().' ';
	$j++;
}
if($adc->CurrentAd->getYearReg())
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('first_time_registered'));
	$rows[0][$j]['value'] = $adc->formatDate($adc->CurrentAd->getYearReg(), 'd.m.Y');
	$j++;
}
if($adc->CurrentAd->getRegistrationNo() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('registration_no'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getRegistrationNo();
	$j++;
}
if($adc->CurrentAd->getSerialNo())
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('chassis').' '.$txt->getWord('number'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getSerialNo();
	$j++;
}

$rows[0][$j]['label'] = '&nbsp;';
$rows[0][$j]['value'] = '';
$j++;

if(($adc->CurrentAd->getTypeId() == 2) && ($adc->CurrentAd->getEuApproved() > 0))
{
	$rows[0][$j]['label'] = 'EU '.ucfirst($txt->getWord('approved'));
	if($adc->CurrentAd->getEuApproved() > 0)
	{ $rows[0][$j]['value'] = ucfirst($txt->getWord('yes')); }
	else
	{ $rows[0][$j]['value'] = ucfirst($txt->getWord('no')); }
	$j++;
}
if($adc->CurrentAd->getEuApprovedDate() != '')
{
	$rows[0][$j]['label'] = 'EU '.ucfirst($txt->getWord('approved').' '.$txt->getWord('date'));
	$rows[0][$j]['value'] = $adc->formatDate($adc->CurrentAd->getEuApprovedDate(), 'd.m.Y');
	$j++;
}	
if($adc->CurrentAd->getMaintenanceDoc() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('maintenance_agreement'));
	$rows[0][$j]['value'] = ucfirst($txt->getWord('yes'));
	$j++;
}
if($adc->CurrentAd->getCeMarked() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('CE_marked'));
	$rows[0][$j]['value'] = ucfirst($txt->getWord('yes'));
	$j++;
}
if($adc->CurrentAd->getConformityDeclaration() > 0)
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('conformity_declaration'));
	$rows[0][$j]['value'] = ucfirst($txt->getWord('yes'));
	$j++;
}

$rows[0][$j]['label'] = '&nbsp;';
$rows[0][$j]['value'] = '';
$j++;

if($adc->CurrentAd->getCabinType() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('cottage_type'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getCabinType();
	$j++;
}
if($adc->CurrentAd->getShaftType() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('shaft_type'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getShaftType();
	$j++;
}

if($adc->CurrentAd->getSuspensionFront() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('suspension_type').' '.$txt->getWord('front'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getSuspensionFront();
	$j++;
}
if($adc->CurrentAd->getSuspensionRear() != '')
{
	$rows[0][$j]['label'] = ucfirst($txt->getWord('suspension_type').' '.$txt->getWord('rear'));
	$rows[0][$j]['value'] = $adc->CurrentAd->getSuspensionRear();
	$j++;
}

// LEFT SIDE COMPLETE
$j = 0;

if($adc->CurrentAd->getLengthUsed() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0) 
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('max')); }
	if($adc->CurrentAd->getTypeId() == 2)
	{ $rows[1][$j]['label'] .= ucfirst($txt->getWord('mileage')); }
	else
	{ $rows[1][$j]['label'] .= ucfirst($txt->getWord('work_hours')); }
	
	$rows[1][$j]['value'] = $adc->CurrentAd->getLengthUsed();
	if($adc->CurrentAd->getTypeId() == 2)
	{ $rows[1][$j]['unit'] = '&nbsp;km'; }
	$j++;
}
if($adc->CurrentAd->getWeight() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0) 
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('max')); }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('net_weight'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getWeight();
	$rows[1][$j]['unit'] = 'kg';
	$j++;
}

if($adc->CurrentAd->getPower() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0) 
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('min')); }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('horsepower'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getPower();
	$j++;
}
if($adc->CurrentAd->getVolume() > 0)
{
	if($adc->CurrentAd->getIsBuying() > 0) 
	{ $rows[1][$j]['label'] = ucfirst($txt->getWord('min')); }
	$rows[1][$j]['label'] .= ucfirst($txt->getWord('engine_volume'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getVolume();
	$rows[1][$j]['unit'] = 'cm&sup3;';
	$j++;
}
/*
if($adc->CurrentAd->getWeight() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('net_weight'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getWeight();
	$rows[1][$j]['unit'] = 'kg';
	$j++;
}
*/
if($adc->CurrentAd->getLoadCapacityWeight() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('load_capacity'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getLoadCapacityWeight();
	$rows[1][$j]['unit'] = 'kg';
	$j++;
}
if($adc->CurrentAd->getLoadCapacityVolume() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('load_capacity'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getLoadCapacityVolume();
	$rows[1][$j]['unit'] = 'm&sup3;';
	$j++;
}
if($adc->CurrentAd->getWheelbase() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('wheelbase'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getWheelbase();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}
if($adc->CurrentAd->getInsideLength() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('inside_length'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getInsideLength();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}
if($adc->CurrentAd->getInsideWidth() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('inside_width'));
	$rows[1][$j]['value'] = $adc->CurrentAd->getInsideWidth();
	$rows[1][$j]['unit'] = 'cm';
	$j++;
}

$rows[1][$j]['label'] = '&nbsp;';
$rows[1][$j]['value'] = '';
$j++;

//$j = 0;
if($adc->CurrentAd->getAirCondition() > 0)
{
	$rows[1][$j]['label'] = 'Air Condition';
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getAutoTrans() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('automatic_transmission'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getTailLift() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('tail_lift'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getAditionalHydra() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('additional_hydraulics'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getTrailerBreak() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('trailer_break'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getClutchlessTurningGear() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('clutchless_turning_gear'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getSpeedGear() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('speedshift'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getSpringCottage() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('suspension_cabin'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getSuspFrontAxle() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('suspension_of_front_axle'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}
if($adc->CurrentAd->getIsTracked() > 0)
{
	$rows[1][$j]['label'] = ucfirst($txt->getWord('with_tracks'));
	$rows[1][$j]['value'] = $okIcon;
	$j++;
}



unset($j);
if($rows > 0)
{
	foreach(array_keys($rows) as $i)
	{
		if(count($rows[$i]) > 0)
		{
			$rows[$i]['table'] = '<table border="0" cellpadding="0" cellspacing="0">';
			foreach(array_keys($rows[$i]) as $j)
			{
				if(is_array($rows[$i][$j]))
				{
					if(is_int($rows[$i][$j]['value']))
					{ $rows[$i][$j]['value'] = number_format($rows[$i][$j]['value'], 0, ',', ' '); }
					
					$rows[$i]['table'] .= 	'<tr>';
					$rows[$i]['table'] .= 		'<td class="left '.$adc->getSetting('AttributeClass').'">'.$rows[$i][$j]['label'].'</td>';
					if($rows[$i][$j]['value'])
					{
						$rows[$i]['table'] .= 		'<td>&nbsp;:&nbsp;&nbsp;</td>';
						$rows[$i]['table'] .= 		'<td class="left '.$adc->getSetting('AttributeValClass').'">'.$rows[$i][$j]['value'].' '.$rows[$i][$j]['unit'].'</td>';
					}
					$rows[$i]['table'] .= 	'</tr>';
				}
			}
			$rows[$i]['table'] .= '</table>';
		}
	}
}
?>
<div class="row-fluid">
	<div class="w60 overflow_hidden"><h3><?php echo $adc->getCurrentAd()->getTitle(); ?></h3></div>
    <div class="w40 top right medium">
    	<?php 
		if(($adc->CurrentAd->getDisplayPrice() > 0) && ($adc->CurrentAd->getPriceGlobal() > 0))
		{ 
			echo '<h3 itemprop="price">';
			require($adc->getViewPath().'elements/Price.php');
			echo '</h3>';
		}
		?>
        <?php if($adc->getCurrentAd()->getIsCompleted() > 0): ?>
        	<div class="sold float-right">
			<p class="float-left"><?php echo ucfirst($adc->getCurrentAd()->getIsBoughtText()); ?>&nbsp;&nbsp;</p>
			<img src="<?php echo SYSICONS_URL ?>ok_24.png" width="24" height="24" alt="<?php echo ucfirst($adc->getCurrentAd()->getIsBoughtText()); ?>" title="<?php echo ucfirst($txt->getWord('sold')); ?>">
			</div>
        <?php endif; ?>
    </div>
</div><hr />
<h3><?php echo ucfirst($txt->getWord('information')); ?></h3>
<div class="row-fluid">
	<div class="span6 col-md-6 w2"><?php  echo $rows[0]['table']; ?></div>
    <div class="span6 col-md-6 w2"><?php  echo $rows[1]['table']; ?></div>
</div><hr />
<?php if($rows[2]): ?>
<h3><?php echo ucfirst($txt->getWord('equipment')); ?></h3>
<div class="row-fluid">
	<div class="span6 col-md-6 w2"><?php  echo $rows[2]['table']; ?></div>
    <div class="span6 col-md-6 w2"><?php // echo $rows[1]['table']; ?></div>
</div><hr />
<?php endif; ?>